home *** CD-ROM | disk | FTP | other *** search
Text File | 1990-07-14 | 847 b | 43 lines | [TEXT/MPS ] |
-
- UNIT LazyPass;
-
- { This is a stand-alone module which implements the function }
- { of determining a circle's area from its circumference. }
-
- INTERFACE
-
- USES
- Types, SAGlobals;
-
- FUNCTION CircleArea (circumference: Real) : Real;
-
- IMPLEMENTATION
-
- { Define a variable global to all }
- { of the routines in this unit! }
- VAR radius : Real;
-
- FUNCTION RadiusSquared : Real;
- FORWARD;
-
- { CircleArea is defined first so that the entry point is }
- { conveniently located at the beginning of the module. }
-
- FUNCTION CircleArea (circumference: Real) : Real;
- VAR
- A5Ref: A5RefType;
- oldA5: Longint;
- BEGIN
- oldA5 := OpenA5World(A5Ref);
- radius := circumference / (2.0 * Pi);
- CircleArea := Pi * RadiusSquared;
- CloseA5World(oldA5, A5Ref);
- END;
-
- FUNCTION RadiusSquared : Real;
- BEGIN
- RadiusSquared := radius * radius;
- END;
-
- END.
-